﻿using System;
using System.Threading.Tasks;

namespace TaskTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello Task!");

            var t1 = Task.Run(Func1);
            var t2 = t1.ContinueWith(Func2);
            // t2.ContinueWith(Func3) ... ...
            t2.Wait();

        }

        static void Func1()
        {
            Console.WriteLine($"Task ID: {Task.CurrentId}");
            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine($"Func1 is Running {i} ......");
                Task.Delay(500).Wait();
            }
        }
        static void Func2(Task t)
        {
            Console.WriteLine($"Task ID: {Task.CurrentId}");
            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine($"Func2 is Running {i} ......");
                Task.Delay(333).Wait();
            }
        }
    }
}
